<template>
	<view class="sceneDoings_box">
		<view class="title_box">
			<span>活动现场</span>
		</view>

		<view v-for="(item,index) in records" :key="item.id">
			<view class="swordsman_box">
				<view class="swordsman_info">
					<image :src="item.memberAvatar" class="image_box">

					</image>
					<span class="name_box">
						{{ item.memberName }}
					</span>
				</view>
				<view class="else_info">
					<span>
						{{ item.publishTime.substr(0,10) }}
					</span>
				</view>
			</view>

			<view class="content_box">
				<span>
					{{item.dynamicContent}}
				</span>
			</view>

			<view class="picture_box">
				<view v-for="imagePath in item.dynamicPicsArr">
					<image :src="imagePath" class="news_picture"></image>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getQueryHeaders,
		requestGet
	} from "@/util/means/request";
	import {
		getFileAccessHttpUrl
	} from "@/util/fileUtil";
	import {
		formatDate
	} from "@/util/timeUtil";
	export default {
		name: "index",
		props: ['sceneData'],
		data() {
			return {
				activityId: '',
				records: [],
				trendsData: [],
			}
		},
		watch: {
			sceneData: {
				handler(newVal, oldVal) {

					this.activityId = newVal.id;
					this.getActivityDynamic();
				},
				deep: true, // 开启深度监视
				immediate: true
			}
		},

		methods: {
			getActivityDynamic() {
				let own = this;
				let params = {
					activityId: own.activityId,
				}
				requestGet({
					url: "/activity/queryActivityDynamic",
					data: params,
					header: getQueryHeaders()
				}).then(res => {
					own.trendsData = res;
					own.records = res.records.map(item => {
						let {
							dynamicPicsArr
						} = item
						item.dynamicPicsArr = dynamicPicsArr != null && Array.isArray(dynamicPicsArr) ?
							dynamicPicsArr.map(imagePath => {
								return imagePath != null && imagePath !== '' ? getFileAccessHttpUrl(
									imagePath) : ''
							}) : []
						item.memberAvatar = item.memberAvatar != null && item.memberAvatar !== '' ?
							getFileAccessHttpUrl(item.memberAvatar) : ''
						item.publishTime = formatDate(item.publishTime, 'YYYY/MM/DD HH:mm')
						return item
					});
					console.log(own.trendsData, '-------------------------')
				}, err => {
					console.log(err, '==============')
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.sceneDoings_box {
		width: 100%;
		box-sizing: border-box;
		padding-left: 30rpx;
		padding-right: 16rpx;



		.title_box {
			width: 100%;
			height: 100rpx;
			display: flex;
			justify-content: start;
			align-items: center;
			font-size: 30rpx;
			font-weight: 600;
			color: #222222;


		}

		.swordsman_box {
			width: 100%;
			height: 100rpx;
			//background-color: pink;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.swordsman_info {
				width: 50%;
				height: 100%;
				//background-color: #BBFFAA;
				display: flex;
				justify-content: start;
				align-items: center;
				font-size: 30rpx;
				color: #707070;

				.image_box {
					width: 74.8rpx;
					height: 74.8rpx;
					border-radius: 50%;
					background-image: url('./image/picture.png');
					background-position: center;
					background-size: cover;
					margin-right: 15rpx;

				}
			}

			.else_info {
				width: 50%;
				height: 100%;
				//background-color: yellow;
				display: flex;
				justify-content: end;
				align-items: center;
				font-size: 26rpx;
				color: #ABABAB;
			}
		}

		.content_box {
			width: 100%;
			font-size: 28rpx;
			color: #707070;
			line-height: 1.5;
			letter-spacing: 5rpx;
			margin-bottom: 30rpx;
		}

		.picture_box {
			width: 100%;
			border-bottom: 1rpx solid #C7C7C7;
			display: flex;
			justify-content: start;
			flex-wrap: wrap;


			.news_picture {
				width: 190rpx;
				height: 155.17rpx;
				background-color: #BBFFAA;
				margin-bottom: 15rpx;
				margin-right: 25rpx;
			}
		}

	}
</style>